﻿using AutoMapper;
using ManagementApi.Models.Manage.ProjectSecurityDeposit;
using Modules.Project;
using PmSoft;

namespace ManagementApi.Models.Manage.ProjectSecurityDepositRecords
{
    public class ProjectSecurityDepositRecordsDto
    {
        /// <summary>
        /// 主键 
        ///</summary>
        public int Id { get; set; }
        /// <summary>
        /// 保证金账户id 
        ///</summary>
        public int SecurityDepositId { get; set; }
        /// <summary>
        /// 保证金账户编号
        /// </summary>
        public string SerialNumber { get; set; }
        /// <summary>
        /// 收支编号 
        ///</summary>
        public string Code { get; set; }
        /// <summary>
        /// 项目id 
        ///</summary>
        public int ProjectId { get; set; }
        /// <summary>
        /// 收支类型(进账,出账) 
        ///</summary>
        public 收支类型 IncomeType { get; set; }
        public string IncomeTypeName { get; set; }
        /// <summary>
        /// 交易类型(资金入账,代发工资,计息,手续费,其他) 
        ///</summary>
        public 交易类型 TradingType { get; set; }
        public string TradingTypeName { get; set; }
        /// <summary>
        /// 缴存类型(按预设比例缴存,免除保证金,减少保证金应交金额,缓缴保证金,增加保证金应缴金额) 
        ///</summary>
        public 缴存类型 DepositeType { get; set; }
        public string DepositeTypeName { get; set; }
        /// <summary>
        /// 缓存起始日期 
        ///</summary>
        public DateTime DepositeStartDate { get; set; }
        /// <summary>
        /// 差异化缓存金额 
        ///</summary>
        public decimal DifferentiatedCacheAmount { get; set; }
        /// <summary>
        /// 收支方式(现金,银行保函,工程担保公司保函,工程保证保险,其它) 
        ///</summary>
        public 收支方式 IncomeWay { get; set; }
        /// <summary>
        /// 应缴金额 
        ///</summary>
        public decimal? AmountPayable { get; set; }
        /// <summary>
        /// 已缴纳金额 
        ///</summary>
        public decimal PaidAmount { get; set; }
        public string IncomeWayName { get; set; }
        /// <summary>
        /// 工资保证金开户银行 
        ///</summary>
        public string? BankName { get; set; }
        /// <summary>
        /// 工资保证金银行账号 
        ///</summary>
        public string? BankNumber { get; set; }
        /// <summary>
        /// 现金金额 
        ///</summary>
        public string CashAmount { get; set; }
        /// <summary>
        /// 担保银行名称 
        ///</summary>
        public string? GuaranteeBankName { get; set; }
        /// <summary>
        /// 银行保函涵号 
        ///</summary>
        public string? BankGuaranteeNumber { get; set; }
        /// <summary>
        /// 银行保函担保金额 
        ///</summary>
        public string? BankGuaranteeAmount { get; set; }
        /// <summary>
        /// 银行保函有效期起始日期 
        ///</summary>
        public DateTime? BankGuaranteeStartDate { get; set; }
        /// <summary>
        /// 银行保函有效期终止日期 
        ///</summary>
        public DateTime? BankGuaranteeEndDate { get; set; }
        /// <summary>
        /// 工程担保公司名称 
        ///</summary>
        public string? GuaranteeCompanyName { get; set; }
        /// <summary>
        /// 工程担保公司保函涵号 
        ///</summary>
        public string? GuaranteeCompanyNumber { get; set; }
        /// <summary>
        /// 工程担保公司担保金额 
        ///</summary>
        public DateTime? GuaranteeCompanyAmount { get; set; }
        /// <summary>
        /// 工程担保公司保函有效起始日期 
        ///</summary>
        public DateTime? GuaranteeCompanyStartDate { get; set; }
        /// <summary>
        /// 工程担保公司保函有效终止日期 
        ///</summary>
        public DateTime? GuaranteeCompanyEndDate { get; set; }
        /// <summary>
        /// 保险公司名称 
        ///</summary>
        public string InsuranceCompanyName { get; set; }
        /// <summary>
        /// 保险单号 
        ///</summary>
        public string? InsuranceNumber { get; set; }
        /// <summary>
        /// 保单金额 
        ///</summary>
        public decimal? InsuranceAmount { get; set; }
        /// <summary>
        /// 保险有效期起始日期 
        ///</summary>
        public DateTime? InsuranceStartDate { get; set; }
        /// <summary>
        /// 保险有效期终止日期 
        ///</summary>
        public DateTime? InsuranceEndDate { get; set; }
        /// <summary>
        /// 其他金额 
        ///</summary>
        public string? OtherAmount { get; set; }
        /// <summary>
        /// 收支日期 
        ///</summary>
        public DateTime? RecordsDate { get; set; }
        /// <summary>
        /// 创建时间 
        ///</summary>
        public DateTime CreateTime { get; set; }
    }

    public static partial class ProjectSecurityDepositRecordsExceptions
    {

        public static ProjectSecurityDepositRecordsDto AsDto(this Modules.ProjectSecurityDepositRecords entity)
        {
            ProjectSecurityDepositRecordsDto dto = new ProjectSecurityDepositRecordsDto();
            var mapper = ServiceAccessor.GetService<IMapper>();
            mapper.Map(entity, dto);
            dto.IncomeTypeName = entity.IncomeType.GetDescription();
            dto.TradingTypeName = entity.TradingType.GetDescription();
            dto.DepositeTypeName = entity.DepositeType.GetDescription();
            dto.IncomeWayName = entity.IncomeWay.GetDescription();
            return dto;
        }
    }
}
